/*
 * TutorAgent.java
 *
 * Created on 3 de Dezembro de 2007, 14:34
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.ufal.ic.mediator;

import br.ufal.ic.mediator.behaviours.SendProblemBehaviour;
import jade.*;
import jade.core.AID;
import jade.core.Agent;
import jade.core.Location;
import jade.domain.DFService;
import jade.domain.FIPAAgentManagement.AMSAgentDescription;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.domain.FIPAException;
import jade.lang.acl.ACLMessage;

/**
 *
 * @author Raphael
 */
public class MediatorAgent extends Agent {
    public MediatorAgent() {}
    
    public MediatorAgent(String problem) {
        Boot.main(new String [] {"-container", "ControllerAgent:br.ufal.ic.controller.ControllerAgent("+problem+")"});
    }
    
    protected void setup() {   
        Object[] args = getArguments();
        
        String problem = null;
        
        if (args != null) {
            for (Object obj : args) {
                if (problem == null) problem = obj.toString();
                else problem += " "+obj.toString();
            }
            addBehaviour(new SendProblemBehaviour(problem));
        }
    }    
}    